<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="org.limp.mine.Label"%>
<%@ page import="org.limp.mine.Controller"%>	
<%@ page import="org.limp.mine.DateTrimmer"%>
<%@ page import="jt.classic.app.hys.Hys_Code"%>
<%@ page import="jt.classic.app.util.*"%>
<% 
    String context = jt.classic.system.ISystem.getContextPath();
	
	String _date = (String)request.getAttribute("_date");
	
	String date = (String)request.getAttribute("date");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>会议室预定查看</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<jsp:include page="../../head.jsp"></jsp:include>
<script language="javascript">
  function handleView(id){
      var url = "<%=context%>/app/hysyd.do?method=view&id=" + id;
      top.xwin(this,url,true,"",900,550);
  }
  
  function handleQuery(){
     var dt = document.form1.qdate.value;
     
     window.location.href = "<%=context%>/app/hysyd.do?method=hysyd_ck&date=" + dt;
  }
  
  function query(){
    document.form1.action = context + "/system/user.do?method=list";
    document.form1.submit();
  }
  
  function handleInsert(){
      var url = "<%=context%>/app/hysyd.do?method=neu";
      window.location.href = url;
  }
</script>
<body>
<form name="form1" method="post" action="">
<h1>会议室预定查看</h1> 
<table width="800" border="0" align="center" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"> 
    	时间 <input type="text" class="box3" style="width:200px;" name="qdate" value="<%=date%>" readonly onclick="javascript:HS_setDate(this)">
    	<a href="javascript:void(0);" onclick="javascript:handleQuery();">查看</a>
    	<a href="javascript:void(0);" onclick="javascript:void(-1);" onclick="javascript:doPrint();">打印</a>
    </td>
  </tr>  
</table>
<br>
<table class="tbl" width="810" align="center">
  <thead>
  <tr>
    <td class="td1" width="11%" scope="col">会议室/时间</td>
    <td class="td1" width="89%" align="left" scope="col">
	<span style=" width:8.333%; float:left; text-align:center ">8点</span>
	<span style="background-color:#ffffff; width:8.333%; float:left; text-align:center ">9点</span>
	<span style=" width:8.333%; float:left; text-align:center ">10点</span>
	<span style="background-color:#ffffff; width:8.333%; float:left; text-align:center ">11点</span>
	<span style=" width:8.333%; float:left; text-align:center ">12点</span>
	<span style="background-color:#ffffff; width:8.333%; float:left; text-align:center ">13点</span>
	<span style=" width:8.333%; float:left; text-align:center ">14点</span>
	<span style="background-color:#ffffff; width:8.333%; float:left; text-align:center ">15点</span>
	<span style=" width:8.333%; float:left; text-align:center ">16点</span>
	<span style="background-color:#ffffff; width:8.333%; float:left; text-align:center ">17点</span>
	<span style=" width:8.333%; float:left; text-align:center ">18点</span>
	<span style="background-color:#ffffff; width:8.333%; float:left; text-align:center ">19点</span>
	
	</td>
  </tr>
  </thead>
    
    <% 
    List hysyd_list_1 = (List) request.getAttribute("hysyd_list_1");
    if(hysyd_list_1!=null&&!hysyd_list_1.isEmpty()){//1
     for(int i1=0;i1<hysyd_list_1.size();i1++){//2
     		
	       List temp_list = (List)hysyd_list_1.get(i1);
	        Map hys_info = (Map)temp_list.get(0);
	        // hys_id  hys_mc
	           String hys_id = hys_info.get("HYS_ID").toString();
    	       String hys_mc = hys_info.get("HYS_MC").toString();
    	    
    %>
    <tr>
    <td class="td1" >&nbsp;<%=hys_mc%></td>
    <td>
    <%
    		List resultList = (List) temp_list.get(1);
    		String start_sj = "080000" ;//8点
    		String end_sj = "200000";
    		float totaltime = DateUtilMy.getMinutesCha("08000","20000");
    if(resultList!=null&&!resultList.isEmpty()){//3
    
       for(int i=0;i<resultList.size();i++){//4
	       Map info = (Map)resultList.get(i);
	       String syd = (String)info.get("HYSYD_ID");
	       String kssj = info.get("HYSYD_KSSJ").toString();
	       String jssj = info.get("HYSYD_JSSJ").toString();

	       String title = DateTrimmer.getYMDHM_LBL(kssj) + " 到 " + DateTrimmer.getYMDHM_LBL(jssj) + "(点击查看详情)";
	       float no_use = DateUtilMy.getMinutesCha(start_sj,kssj.substring(8,14));
	       
	       float use = 0;
	       
	       if(!kssj.substring(0,8).equals(_date) && !jssj.substring(0,8).equals(_date)){
	          no_use = 0;
	          use = DateUtilMy.getMinutesCha(start_sj,end_sj);
	       }else if(!kssj.substring(0,8).equals(_date) && jssj.substring(0,8).equals(_date)){
	          no_use = 0;
	          use = DateUtilMy.getMinutesCha(start_sj,jssj.substring(8,14));
	       }else if(kssj.substring(0,8).equals(jssj.substring(0,8))){
	          use = DateUtilMy.getMinutesCha(kssj.substring(8,14),jssj.substring(8,14));
	       }else{
	          use = DateUtilMy.getMinutesCha(kssj.substring(8,14),end_sj);
	       }

	       no_use = no_use/totaltime * 100;
	       use = use/totaltime * 100;
    %>
	<span style="background-color:#FFFFFF; width:<%=no_use%><%=no_use==0?"":"%"%>; float:left; text-align:center "></span>
	<span style="background-color:#0099FF; cursor:hand; color:#ffffff; width:<%=use%><%=use==0?"":"%"%>;float:left; text-align:center " onclick="javascript:handleView('<%=syd%>');" title="<%=title%>">已预定</span>

	<%
		}//4
	%>
		</td>
		</tr>
	<%
		}//
	  }//
	}
	%>
</table>
</form>
</body>
</html>	